class Solution:
    def maxProfit(self, prices: List[int]) -> int:
        n=len(prices)
        ans=0
        for i in range(0,n-1):
            for j in range(i+1 ,n):
                ans=max(ans,prices[j]-prices[i])
        return ans



